Skip to content

feat: support remote mcp - #8

Open
orionpax1997 wants to merge 2 commits into
keybrdist:mainfrom
orionpax1997:main
Open

feat: support remote mcp#8
orionpax1997 wants to merge 2 commits into
keybrdist:mainfrom
orionpax1997:main

Conversation

@orionpax1997

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds remote MCP server support alongside a broader set of packaging and skill-discovery changes for the OpenCode Lazy Loader plugin (now scoped/renamed), enabling skills to connect either via local stdio commands or via Streamable HTTP transport.

Changes:

  • Add RemoteMcpServerConfig + Streamable HTTP transport support in the MCP manager (remote vs local).
  • Update skill discovery paths from skill/ to skills/ and add a Playwright example skill under .opencode/skills/.
  • Rename/rebrand the npm package and update exports/docs accordingly.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/utils/env-vars.ts Adjusts command/env normalization typing to local config (needs API/type alignment for union callers).
src/types.ts Introduces local vs remote MCP config types and a unified union type.
src/skill-mcp-manager.ts Adds Streamable HTTP transport support and selects transport based on config type.
src/skill-loader.ts Updates discovery/loader logic and directory naming, plus minor typing changes.
src/index.ts Re-exports newly added MCP config types.
README.md Updates installation and examples for the renamed package and new skills/ paths.
package.json Renames the package and updates metadata/scripts (publishing script needs attention).
package-lock.json Updates lockfile content but still references the old package name (needs regeneration/aligning).
AGENTS.md Updates documented skill discovery directories to skills/.
.opencode/skills/playwright-example/SKILL.md Adds a new example skill embedding the Playwright MCP server.
Suppressed comments (2)

src/utils/env-vars.ts:83

  • normalizeCommand currently only accepts LocalMcpServerConfig, which makes passing a McpServerConfig value (local-or-remote union) a type error even when the runtime value is local. Consider accepting McpServerConfig and explicitly rejecting type: "remote" here to keep the helper usable across the codebase.
export function normalizeCommand(config: LocalMcpServerConfig): NormalizedCommand {
  if (Array.isArray(config.command)) {
    if (config.command.length === 0) {
      throw new Error('Invalid MCP command configuration: command array must not be empty')
    }

src/utils/env-vars.ts:102

  • Same as normalizeCommand: normalizeEnv being restricted to LocalMcpServerConfig makes it awkward to call with variables typed as the McpServerConfig union. Widen the type and explicitly reject type: "remote" so misuse fails fast.
export function normalizeEnv(config: LocalMcpServerConfig): NormalizedEnv {
  const envConfig = config.env ?? config.environment
  if (!envConfig) {
    return { env: {} }
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/skill-loader.ts
scope: SkillScope
): Promise<LoadedSkill[]> {
const entries = await fs.readdir(skillsDir, { withFileTypes: true }).catch(() => [])
const entries: Dirent<string>[] = await fs.readdir(skillsDir, { withFileTypes: true }).catch(() => [])
Comment thread src/skill-mcp-manager.ts
Comment on lines +202 to +210
let url: URL
try {
url = new URL(config.url)
} catch {
throw new Error(
`MCP server "${info.serverName}" has an invalid URL: ${config.url}\n\n` +
`The URL must be a valid HTTP or HTTPS URL.`
)
}
Comment thread src/utils/env-vars.ts
@@ -1,4 +1,4 @@
import type { McpServerConfig, NormalizedCommand, NormalizedEnv } from '../types.js'
import type { LocalMcpServerConfig, NormalizedCommand, NormalizedEnv } from '../types.js'
Comment thread src/types.ts
url: string
/** Custom headers to send with requests */
headers?: Record<string, string>
/** OAuth configuration, or false to disable OAuth */
Comment thread package.json
Comment on lines 17 to +22
"scripts": {
"build": "npx tsc",
"watch": "npx tsc --watch",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest",
"prepack": "npm run clean && npm run build"
"test:watch": "vitest"
Comment thread README.md
```json
{
"plugin": ["./path/to/opencode-lazy-loader"]
"plugin": ["./path/to/@orionpax/opencode-lazy-mcp"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants